<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: save_sort_order.php 350 2013-10-19 10:40:03Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 350 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-10-19 10:40:03 +0000 (Sat, 19 Oct 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

chdir('../../../../');
include('includes/application_top.php');

if($_POST['action'] == "category_sort") {
	$post = $_POST['cat'];
	$i = 1;
	foreach ($post as $cID) {
		$db->db_query("UPDATE ".TABLE_CATEGORIES." SET sort_order = ".$i." WHERE categories_id = ".$cID);
		$i++;	
	}
	
} elseif($_POST['action'] == "products_sort") {
	$post = $_POST['p'];
	$i = 1;
	foreach ($post as $pID) {
		$db->db_query("UPDATE ".TABLE_PRODUCTS." SET products_sort = ".$i." WHERE products_id = ".$pID);
		$i++;
	}
}
?>